/*
 * @Description  : 
 * @Version      : 1.0
 * @Author       : Shiming
 * @Date         : 2021-12-27 10:30:56
 * @LastEditors  : Shiming
 * @LastEditTime : 2022-04-18 16:37:20
 * @FilePath     : \\tms-obc-web\\src\\app\\routes\\datatable\\services\\data.service.ts
 * Copyright (C) 2022 huzhenhong. All rights reserved.
 */

import { Injectable, Injector } from '@angular/core';
import { _HttpClient } from '@delon/theme';
import { ShipperBaseService } from '@shared';
import { map } from 'rxjs/operators';

@Injectable({
  providedIn: 'root',
})
export class DataService extends ShipperBaseService {

  // 查询运营报表
  $api_listOperationalReportPage = `/api/sdc/report/listOperationalReportPage`;
  // 查询业绩报表
  $api_listPerformanceReportPage = `/api/sdc/report/listPerformanceReportPage`;
  // 运营报表运单状态分布
  $api_operationalReportWaybillStatusDistribution = `/api/sdc/report/operationalReportWaybillStatusDistribution`;
  // 运营报表柱状图
  $api_operationalReportHistogram = `/api/sdc/report/operationalReportHistogram`;
  // 获取网络货运人
  $api_get_network_freight_forwarder_list = `/api/mdc/cuc/networkTransporter/findAll`;
  // 业绩报表柱状图
  $api_performanceReportHistogram = `/api/sdc/report/performanceReportHistogram`;

  // 查询开票数据报表
  $api_findInvoiceReport = `/api/fcc/invoiceReport/findInvoiceReport`;
  // 查询开票数据报表
  $api_listFinancialReportPage = `/api/sdc/report/listFinancialReportPage`;


  // 查询货主报表
  $api_listShipperReportPage = `/api/sdc/report/listShipperReportPage`;
  // 司机报表
  $api_listDriverReportPage = `/api/sdc/report/listDriverReportPage`;
  // 财务报表柱状图
  $api_financialReportHistogram = `/api/sdc/report/financialReportHistogram`;
  // 合规监控报表-运费直付占比
  $api_getBillRateDirectPayment = `/api/sdc/reportComplianceMonitor/getBillRateDirectPayment`;
  // 合规监控报表-货源单占比
  $api_getBillRateProportion = `/api/sdc/reportComplianceMonitor/getBillRateProportion`;
  // 合规监控报表-订单合格率
  $api_getBillRateQualified = `/api/sdc/reportComplianceMonitor/getBillRateQualified`;
  // 合规监控报表-付款及时率
  $api_getBillTimelyPayment = `/api/sdc/reportComplianceMonitor/getBillTimelyPayment`;
  // 合规监控报表-监控报表(折线图)
  $api_listMonitorSituation = `/api/sdc/reportComplianceMonitor/listMonitorSituation`;


  // 客户报表-根据类型获取统计信息(card)
  $api_statistics_total = `/api/mdc/cuc/statistics/total`;
  // 客户报表-根据类型获取统计明细信息(table)
  $api_statistics_totalDetail = `/api/mdc/cuc/statistics/totalDetail`;
  // 客户报表-根据类型获取统计图表信息
  $api_statistics_totalAdd = `/api/mdc/cuc/statistics/totalAdd`;


  // 数据大屏-本年全年交易情况
  $api_getAnnualTransactions = `/api/sdc/reportDataLargeScreen/getAnnualTransactions`;
  // 数据大屏-客户统计(货主，合伙人，司机，车辆)
  $api_getCustomerStatistics = `/api/sdc/reportDataLargeScreen/getCustomerStatistics`;
  // 数据大屏-实时货源
  $api_getRealTimeSupply = `/api/sdc/reportDataLargeScreen/getRealTimeSupply`;
  // 数据大屏-实时运单风控
  $api_getRealTimeWaybillRiskControl = `/api/sdc/reportDataLargeScreen/getRealTimeWaybillRiskControl`;
  // 数据大屏-本月发货量排名
  $api_getShipmentRanking = `/api/sdc/reportDataLargeScreen/getShipmentRanking`;
  // 数据大屏-今日交易情况
  $api_getTradingToday = `/api/sdc/reportDataLargeScreen/getTradingToday`;
  // 数据大屏-本月交易趋势
  $api_getTradingTrend = `/api/sdc/reportDataLargeScreen/getTradingTrend`;
  // 数据大屏-交易额(今日，本月，累计)
  $api_getTransactionAmount = `/api/sdc/reportDataLargeScreen/getTransactionAmount`;
  // 数据大屏-交易分布
  $api_getTransactionDistribution = `/api/sdc/reportDataLargeScreen/getTransactionDistribution`;

  // 客户-合规报表
  $api_listCusComplianceReportPage = `/api/sdc/report/listCusComplianceReportPage`;

  // 查询业务员报表-客户、合伙人
  $api_listPartBusinessReportPage = `/api/sdc/report/listPartBusinessReportPage`;
  // 业务员-合规报表
  $api_listPartComplianceReportPage = `/api/sdc/report/listPartComplianceReportPage`;

  // 数据报表-订单类型比例
  $api_getBillTypeProportion = `/api/sdc/reportData/getBillTypeProportion`;
  // 数据报表-运单直付比例
  $api_getWayBillDirectProportion = `/api/sdc/reportData/getWayBillDirectProportion`;
  // 数据报表-统计订单金额-趋势
  $api_getBillAmount = `/api/sdc/reportData/getBillAmount`;
  // // 数据报表-统计订单金额-趋势
  $api_get_bill_payment_amount = `/api/sdc/reportData/getBillPaymentAmount`;
  // 客户预存款总额
  $api_total_advance_deposit = `/api/sdc/reportData/getTotalAdvanceDeposit`;
  // 业绩量总额
  $api_total_performance_volume = `/api/sdc/reportData/getTotalPerformanceVolume`;
  // 运费总额
  $api_total_freight = `/api/sdc/reportData/getTotalFreight`;
  // 附加费总额
  $api_total_surcharge = `/api/sdc/reportData/getTotalSurcharge`;
  // 运营导出
  $api_asyncExportOperationalReport = `/api/sdc/report/asyncExportOperationalReport`;
  // 监管订单对比
  $api_getRegulationBillInfos = `/api/sdc/regulation/getRegulationBillInfos`;
  // 监管订单对比tab数量
  $api_getRegulationTabCounts = `/api/sdc/regulation/getRegulationTabCounts`;
  // 监管订单对比同步
  $api_regulationBillSync = `/api/sdc/regulation/regulationBillSync`;
  
  // 监管资金对比list
  $api_queryZjDataList = `/api/sdc/regulation/queryZjDataList`;
  // 监管订单对比同步
  $api_regulation_regulationBillSync = `/api/sdc/regulation/regulationBillSync`;
  // 资金对比tab数量
  $api_getRegulationZJTabCounts = `/api/sdc/regulation/getRegulationZJTabCounts`;



  constructor(public injector: Injector) {
    super(injector);
  }

  /**
* 获取网络货运人
* @returns
*/
  getNetworkFreightForwarder(params = {}, containerAll = false) {
    return this.request(this.$api_get_network_freight_forwarder_list, params).pipe(
      map((res: any) => {
        if (!res) {
          return [];
        }
        const list = res.map((item: any) => {
          return {
            label: item.enterpriseName,
            value: item.id
          };
        });
        const obj = [];
        if (containerAll) {
          obj.push({ label: '全部', value: '' });
        }
        return [...obj, ...list];
      })
    );
  }

  getPerformanceReportHistogram(params = {}) {
    return this.request(this.$api_performanceReportHistogram, params)
  }
}
